-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[api] implement web3 API debug_traceTransaction #3779
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3779 +/- ##
==========================================
+ Coverage 74.47% 75.36% +0.89%
==========================================
Files 269 303 +34
Lines 23925 25910 +1985
==========================================
+ Hits 17818 19528 +1710
- Misses 5174 5359 +185
- Partials 933 1023 +90
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
api/coreservice.go
Outdated
@@ -1582,3 +1587,29 @@ func (core *coreService) SyncingProgress() (uint64, uint64, uint64) { | |||
startingHeight, currentHeight, targetHeight, _ := core.bs.SyncStatus() | |||
return startingHeight, currentHeight, targetHeight | |||
} | |||
|
|||
// TraceTransaction returns the trace result of transaction | |||
func (core *coreService) TraceTransaction(ctx context.Context, actHash string, config *logger.Config) (retval []byte, receipt *action.Receipt, traces *logger.StructLogger, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grpcserver.TraceTransactionStructLogs
should be integrated with this func
@@ -75,6 +80,28 @@ type ( | |||
CurrentBlock string `json:"currentBlock"` | |||
HighestBlock string `json:"highestBlock"` | |||
} | |||
structLog struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if custom marshalling is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, structLog
= logger.StructLog
, but logger.StructLog
ignored json field storage
, web3 API needs to export it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it could be done in MarshalJSON()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no need to implement marshalJSON
here, the structLog
field can already be automatically marshaled inside. use interface{}
is harder to understand
add test for the new api |
add test for the code in coreservice.go |
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
Description
request:
response:
Fixes #3775
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: